<?php
/**
 * Created by PhpStorm.
 * User: Thinkpad
 * Date: 2015/7/27
 * Time: 14:11
 */
namespace Org\Util;

class yyf{

    function sms($tel='',$contents=''){
        $user = '13437'; // sms9的cpid
        $channelid = '2183'; // sms9的通道id
        $pwd = 'shequo2o';//sms9的原始密码
        $timestamp = time();
        $pwd_str = $pwd."_".$timestamp."_topsky";
        $md5_pwd = md5($pwd_str);
        $phone=$tel;
        $content=$contents;
        //如果页面是utf-8 则需要转成gbk
        $content = iconv("utf-8","gbk//ignore",$content);
        $content = urlencode($content);
        //$api = " http://admin.sms9.net/houtai/sms.php?cpid=$user&password=$md5_pwd&channelid=$channelid&tele=$phone&msg=$content&timestamp=$timestamp";

        $a = file_get_contents("http://admin.sms9.net/houtai/sms.php?cpid=$user&password=$md5_pwd&channelid=$channelid&tele=$phone&msg=$content&timestamp=$timestamp");
        echo $a;
    }
}